﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:Ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary">
	<Style TargetType="Ribbon:RibbonGalleryItem">
		<!--<Setter Property="Padding" Value="5,4,5,5" />-->
		<Setter Property="Padding" Value="0" />
		<Setter Property="BorderThickness" Value="0" />
		<Setter Property="VerticalContentAlignment" Value="Center" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Ribbon:RibbonGalleryItem}">
					<Grid x:Name="MainGrid" SnapsToDevicePixels="True">
						<Border x:Name="OuterBorder" BorderBrush="{TemplateBinding BorderBrush}"
								BorderThickness="{TemplateBinding BorderThickness}"
								Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
							<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}"
									Content="{TemplateBinding Content}"
									ContentStringFormat="{TemplateBinding ContentStringFormat}"
									HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
									RecognizesAccessKey="True"
									VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
						</Border>
						<Border x:Name="PressedStateOverlay" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Opacity" Value="0.5" />
							<Setter Property="TextElement.Foreground" TargetName="MainGrid" Value="#FF3F3F3F" />
						</Trigger>
						<MultiTrigger>
							<MultiTrigger.Conditions>
								<Condition Property="IsHighlighted" Value="True" />
								<Condition Property="IsPressed" Value="False" />
							</MultiTrigger.Conditions>
							<Setter Property="Background" TargetName="OuterBorder"
									Value="{Binding MouseOverBackground, RelativeSource={RelativeSource TemplatedParent}}" />
							<Setter Property="BorderBrush" TargetName="OuterBorder"
									Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
						</MultiTrigger>
						<Trigger Property="IsPressed" Value="True">
							<Setter Property="Background" TargetName="OuterBorder"
									Value="{Binding PressedBackground, RelativeSource={RelativeSource TemplatedParent}}" />
							<Setter Property="BorderBrush" TargetName="OuterBorder"
									Value="{Binding PressedBorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
							<Setter Property="Background" TargetName="PressedStateOverlay" Value="#30FFFFFF" />
						</Trigger>
						<Trigger Property="IsSelected" Value="True">
							<Setter Property="Background" TargetName="OuterBorder"
									Value="{Binding CheckedBackground, RelativeSource={RelativeSource TemplatedParent}}" />
							<Setter Property="BorderBrush" TargetName="OuterBorder"
									Value="{Binding CheckedBorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>